<?php

namespace app\queue\stomp;

use app\queue\BaseConsumer;
use common\service\ChatService;

/**
 * 修改工单助手的最后一次信息时间
 */
class UpdateWorkOrderAssistantEditedAtConsumer extends BaseConsumer
{

    // 要消费的队列名
    public $queue = 'update_work_order_assistant_edited_at';

    // 连接名，对应 config/redis_queue.php 里的连接`
    public $connection = 'default';

    /**
     * @param $data
     */
    public function doConsume($data)
    {
        try {
            $chatService = ChatService::getInstance();
            $chatService->updateWorkOrderAssistantEditedAt($data['global_id'], $data['sent_at']);
        } catch (\Throwable $e) {
            trace(format_exception_info($e), 'ERR');
        }
    }
}
